<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>享送小哥</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
</head>

<body>
    <div id="data-loading">
        <div class="loading1"><img src="../images/loading.gif"></div>
    </div>
    <div class="aui-content vue">
        <ul class="coupon-list aui-margin-t-10" id="coupon-tab" v-if="coupons.length>0">
            <li class="blue" v-for="item in coupons">
                <div class="coupon-left"><span>{{item.amount}}</span>元</div>
                <div class="coupon-right">
                    <h4>{{item.name}}</h4>
                    <p>{{item.desc}}</p>
                    <p>有效日期：{{item.end_time}}</p>
                </div>
            </li>
        </ul>
        <div v-if="coupons.length==0" style="text-align:center;margin-top:50px;color:#666;">没有优惠券!</div>
    </div>
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/vue.js"></script>
    <script type="text/javascript" src="../script/app.js"></script>
    <script type="text/javascript">
        apiready = function() {
            var status = api.pageParam.status;
            vObj = new Vue({
                el: ".vue",
                data: {
                    coupons: []
                },
                methods: {
                    getCoupos: function() {
                        app.request.post('Client/coupon', {
                            status: status
                        }, {}, function(res) {
                            if (res.code == 200) {
                                vObj.coupons = res.data;
                                app.request.finish(vObj);
                            } else {
                                app.error(res.message);
                            }
                        });
                    }
                }
            })

            vObj.getCoupos();
        }
    </script>
</body>

</html>
